/**
 * 
 */
package de.midnightdance.admin.jagdTechnik;

import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;

import de.midnightdance.admin.Activator;

/**
 * @author Stefan Alter
 *
 */
public class ListenerViewJagdTechniken implements IPartListener {

	/**
	 * 
	 */
	public ListenerViewJagdTechniken() {		
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
	 */
	@Override
	public void partActivated(IWorkbenchPart part) {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
	 */
	@Override
	public void partBroughtToTop(IWorkbenchPart part) {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
	 */
	@Override
	public void partClosed(IWorkbenchPart part) {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
	 */
	@Override
	public void partDeactivated(IWorkbenchPart part) {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
	 */
	@Override
	public void partOpened(IWorkbenchPart part) {
		if (part instanceof ViewJagdTechniken) {
			ViewJagdTechniken view = (ViewJagdTechniken) part;
			System.out.println("ViewJagdTechniken opened");
			//
			PresenterEditJagdTechniken presenter = new PresenterEditJagdTechniken();
			//get user that logged in
			presenter.setUser(Activator.getDefault().getLoggedUser());
			//
			presenter.initData();
			//
			presenter.setView(view.getCompositeEditEntities());				
		}
	}

}
